#pragma once

#include "fxcc/core/graph/common/Params.h"

namespace fxcc::graph::common
{

	struct Defines
	{
		struct Pair
		{
			std::string m_Key;
			std::string m_Value;
		};

		bool m_HasSkinnedShader{ true };

		std::vector<Pair> m_Values;

		void Insert(const std::string& key, const std::string& value)
		{
			auto index = GetKey(key);
			Pair pair;
			pair.m_Key = key;
			pair.m_Value = value;

			if (index == -1)
			{
				m_Values.push_back(pair);
			}
			else
			{
				m_Values[index].m_Value = value;
			}
		}

		int GetKey(const std::string& key)
		{
			int index = 0;
			for (const auto& it : m_Values)
			{
				if (it.m_Key == key)
				{
					return index;
				}
				index++;
			}
			return -1;
		}
		void Effect(kainjow::mustache::list& l) const
		{
			for (const auto& it : m_Values)
			{
				std::string key = it.m_Key;
				if (key.empty())
				{
					continue;
				}
				std::string value = it.m_Value;
				kainjow::mustache::data d1;
				d1.set("key", key);
				d1.set("value", value);
				l.push_back(d1);
			};

		};
	};
};

